﻿using System;
using System.Collections.Generic;
using System.Text;
using MySql.Data.MySqlClient;

namespace tc58News
{
	public class Dao
	{
		public void Add58tc_cn(HtmlSource source)
		{
			string connStr = System.Configuration.ConfigurationManager.AppSettings.Get("connstr");


			using (MySqlConnection conn = new MySqlConnection(connStr))
			{
				conn.Open();
				MySqlCommand cmd = new MySqlCommand();
				cmd.Connection = conn;
				cmd.Parameters.Add("?Content", MySqlDbType.Text).Value = source.Content;
				cmd.Parameters.Add("?CateType", MySqlDbType.Int32).Value = source.CateType;
				cmd.Parameters.Add("?SourceUrl", MySqlDbType.VarChar).Value = source.SourceUrl;
				cmd.CommandText = "insert into 58tc_cn(Content,CateType,SourceUrl) values(?Content,?CateType,?SourceUrl)";
				cmd.CommandType = System.Data.CommandType.Text;

				cmd.ExecuteNonQuery();
			}
		}
	}
}
